﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace _85_IEnumerable接口与yield_return语句_循环
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("枚举出object类型：");
            foreach (var item in Test1())
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("枚举出string类型：");
            foreach (var item in Test2())
            {
                Console.WriteLine(item);
            }
        }
        static IEnumerable  Test1()
        {
            yield return 0;
            yield return 1;
            yield return 2;
        }

        static IEnumerable<string> Test2()
        {
            yield return "abcd";
            yield return "opqrs";
            yield return "@#$%";
        }
    }
}
